package com.dice.dagger2study.ui;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;

import com.dice.dagger2study.present.BasePersenter;

/**
 * Created by weiyi on 2017/11/14.
 */

public abstract class BaseActivity<V,T extends BasePersenter<V>> extends AppCompatActivity {


    protected  T mPresent;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPresent=createPresent();
        mPresent.attachView((V) this);
    }

    /**
     * 子类实现具体的构建过程
     * @return
     */
    protected abstract T createPresent() ;

    @Override
    protected void onDestroy() {
        mPresent.detach();
        super.onDestroy();

    }
}
